#ifndef _BLOCKBREAKER_GAME_SERVERLOGIC_H__
#define _BLOCKBREAKER_GAME_SERVERLOGIC_H__

#include <Game/Include/DistributionLogic.h>

/// \brief implements server-side logic for ordering the events, 
/// \details it receives the input event from local player, generates also a time step to maintain it in order between user's inputs,
/// and then delivers the game events in the same order to the client-side, and to the output_queue
class ServerLogic : public DistributionLogic
{
public:
    ServerLogic(Channel* comm_channel, SyncQueue* output_queue, int time_step_ms);
    virtual ~ServerLogic();

    virtual void processGameEvent(GameEvent* game_event);
    void startClock();
    void stopClock();

private:
    SyncQueue* ordering_queue;
    Task* output_task;
    Task* clock_task;
    int time_step_ms;

    static void output_task_function(void* user_data);
    static void clock_task_function(void* user_data);

    
};

#endif //_BLOCKBREAKER_GAME_SERVERLOGIC_H__